add clarification stating that the construct_child function is responsible
authorRyan Lortie <desrt@desrt.ca>
Tue, 27 Nov 2007 03:25:09 +0000 (03:25 +0000)
committerRyan Lortie <ryanl@src.gnome.org>
Tue, 27 Nov 2007 03:25:09 +0000 (03:25 +0000)
2006-11-26  Ryan Lortie  <desrt@desrt.ca>

        * docs/reference/gtk/tmpl/gtkbuildable.sgml: add clarification stating
        that the construct_child function is responsible for returning a
        reference.
        * gtkbuilder.c (_gtk_builder_construct): remove g_object_ref() for
        objects from constructors
        * gtkuimanager.c (gtk_ui_manager_buildable_construct_child): add
        g_object_ref() to this construction function (it's the only
        implementer in GTK)

        Fixes #496645.

svn path=/trunk/; revision=19075

ChangeLog
docs/reference/gtk/tmpl/gtkbuildable.sgml
gtk/gtkbuilder.c
gtk/gtkuimanager.c

index 24ca93e3ad5ff17959653d8b0285e5f7d7be730e..e0aae44431e4ac8b714730acd9747e1f88f4f51a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2006-11-26  Ryan Lortie  <desrt@desrt.ca>
+
+       * docs/reference/gtk/tmpl/gtkbuildable.sgml: add clarification stating
+       that the construct_child function is responsible for returning a
+       reference.
+       * gtkbuilder.c (_gtk_builder_construct): remove g_object_ref() for
+       objects from constructors
+       * gtkuimanager.c (gtk_ui_manager_buildable_construct_child): add
+       g_object_ref() to this construction function (it's the only
+       implementer in GTK)
+
+       Fixes #496645.
+
 2006-11-26  Ryan Lortie  <desrt@desrt.ca>
 
        * gtkbuilder.c: remove concept of root objects and just refcount
index a140d78688d40212f4d94db7311454978d30bb6a..16857ae60ccc29ec6070de3041e8cbfea3c44677 100644 (file)
@@ -61,7 +61,8 @@ a GtkBuilder UI definition.
 @construct_child: Constructs a child of a buildable that has been
   specified as "constructor" in the UI definition. #GtkUIManager implements 
   this to reference to a widget created in a &lt;ui&gt; tag which is outside 
-  of the normal GtkBuilder UI definition hierarchy.
+  of the normal GtkBuilder UI definition hierarchy.  A reference to the
+  constructed object is returned and becomes owned by the caller.
 @custom_tag_start: Implement this if the buildable needs to parse 
   content below &lt;child&gt;. To handle an element, the implementation
   must fill in the @parser structure and @user_data and return %TRUE.
index 5f6e1dff88faecc8a6dfa91d55b6829d4847a636..263698b22af77197fb5bdd888c060c3da85428f4 100644 (file)
@@ -402,7 +402,6 @@ _gtk_builder_construct (GtkBuilder *builder,
       g_assert (obj != NULL);
       if (construct_parameters->len)
         g_warning ("Can't pass in construct-only parameters to %s", info->id);
-      g_object_ref (obj);
     }
   else if (info->parent && ((ChildInfo*)info->parent)->internal_child != NULL)
     {
index 9528bc41f54bcce7d4c129d97e370a2aa4888ac8..2273579d1aba1c9bfc583cdc7ea8bd70494d575c 100644 (file)
@@ -497,7 +497,7 @@ gtk_ui_manager_buildable_construct_child (GtkBuildable *buildable,
   g_signal_connect (widget, "hierarchy-changed",
                    G_CALLBACK (child_hierarchy_changed_cb),
                    GTK_UI_MANAGER (buildable));
-  return G_OBJECT (widget);
+  return g_object_ref (widget);
 }
 
 static void